using Microsoft.VisualStudio.TestTools.UnitTesting;
using ModbusRTU;
using System;
using System.IO.Ports;
using System.Threading;

namespace TestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            MyClass myClass = new MyClass();
            myClass.ListTest();
        }

        [TestMethod]
        public void TestMethod2()
        {
            MyClass myClass = new MyClass();
            myClass.DictionaryTest();
        }

        [TestMethod]
        public void TestMethod3()
        {
            MyClass myClass = new MyClass();
            myClass.INITest();
        }

        [TestMethod]
        public void TestMethod4()
        {
            MyClass myClass = new MyClass();
            myClass.FileTest();
        }

        [TestMethod]
        public void TestMethod5()
        {
            //MyClass myClass = new MyClass();
            //myClass.SerialPortTest();
            SerialPort mySerialPort = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);
            Modbus modbus = new Modbus();
            modbus.Sends(mySerialPort, 1, 3, 100, 3);
            Thread.Sleep(500);
            double[] reveive = modbus.Receive(mySerialPort);
            foreach (double d in reveive)
            {
                System.Console.WriteLine(d);
            }


        }
        [TestMethod]
        public void TestMethod6()
        {
            //(1 == 1 && 2 == 2) ||(3 == 3 && 4 == 5)
            if (1 == 3 && 2 == 3 || 3 == 3 && 5 == 5)
            {
                System.Console.WriteLine("hello world1");
            }
            float a = 1030 / (float)100;
            byte[] sendData = new byte[5];
            sendData[0] = Convert.ToByte(0xAF);
            sendData[1] = Convert.ToByte(0x00);
            sendData[2] = Convert.ToByte(0x01);
            sendData[3] = Convert.ToByte(0x00);
            sendData[4] = Convert.ToByte(0x03);
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(sendData[i]);
            }
            System.Console.WriteLine(a);
        }

        [TestMethod]
        public void TestMethod7()
        {
            MyClass myClass = new MyClass();
            //myClass.TestAtan2();
            myClass.TestCogCreateSegmentTool(-0.0034);
        }

        [TestMethod]
        public void TestMethod8()
        {
            MyClass.FindCircleCenter(Math.Sqrt(3),1, 2, 0 ,- 30);
            //myClass.TestAtan2();
           
        }
        [TestMethod]
        public void TestMethod9()
        {
            MyClass myClass = new MyClass();
           
            //myClass.TestAtan2();

        }

    }
}